jsx3.Class.defineClass(
    "ux.cdb.admin.dataautomate.TxtUpdater",
    ux.cdb.admin.dataautomate.GenericUpdater, null,
    function (block) {

        /**
        * instance initializer
        * @param strName {String} unique name distinguishing this object from all other JSX GUI objects in the JSX application
        * @param vntLeft {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
        * @param vntTop {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
        * @param vntWidth {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
        * @param vntHeight {int|String} either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
        * @param strHTML {String} Text/HTML markup to place in the jsx3.gui.Block instance
        */
        block.prototype.init = function(strName, vntLeft, vntTop, vntWidth, vntHeight, strHTML) {
            //call constructor for super class (the super expects the name of the object and the function that it is an instance of)
            this.jsxsuper(strName, vntLeft, vntTop, vntWidth, vntHeight, strHTML);
        };

        block.prototype.applyData = function(data) {
            var me = this;
            var text = data[this.uxdataatt];
            if(me.formatHandler){
                var fn = jsx3.eval("var fn = " + me.formatHandler + "; fn;");
                text = fn(text);
            }
            this.getDescendantOfName("txtValue").setValue(text,true);
        };
        
        block.prototype.extractData = function(){
            return this.getDescendantOfName("txtValue").getValue();
        };
                
        //methods from IExtractor interface for support validation correctly
        block.prototype._validateFailedUI = function(failed,message){
            var objText = this.getDescendantOfName("txtValue");
            
            if(failed === true){
                objText.setBackgroundColor(ux.megatron.Main.getServer().getDynamicProperty("@cdb@Validation Failed BGColor"), true);
                objText.setTip((message) ? message : "");
            }else{
                if(objText.getEnabled() == jsx3.gui.Form.STATEDISABLED) {
                    var color = ux.megatron.Main.getServer().getDynamicProperty("@cdb@Disabled BGColor");
                    color = color || jsx3.gui.Form.DEFAULTDISABLEDBACKGROUNDCOLOR;
                    objText.setBackgroundColor(color, true);
                } else {
                    objText.setBackgroundColor("#FFFFFF", true);
                }
                objText.setTip("");
            }
        };

        block.prototype.setTriggerEvent = function() {
            if(this.get("txtValue") && !jsx3.IDE) { 
                this.get("txtValue").setEvent("//nothing", jsx3.gui.Interactive.JSXKEYUP); 
            }
        };

        block.prototype.setAsTriggerField = function() {
            if(this.get("txtValue")) {
                this.get("txtValue").subscribe(jsx3.gui.Interactive.JSXKEYUP, this, function() {
                    var fieldName = this.getName();
                    if(this.provider.onTriggerFieldChange) {
                        this.provider.onTriggerFieldChange(fieldName);
                    }
                });
            }
        };

        block.prototype.focusField = function() {
            if(this.get("txtValue")) {
                this.get("txtValue").focus();
            }
        };
        
    });
